﻿


using System;
using System.Text;
using System.Collections;
using System.Xml;
using System.Data;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Resources;
using System.Reflection;
using System.Globalization;
using System.Threading;

using Telerik.WebControls;
using UFSoft.UBF.UI.WebControls;
using UFSoft.UBF.UI.WebControls.InterActionComponenet;
using UFSoft.UBF.Util.Log;
using UFSoft.UBF.Util.Context;

//using MagicAjax.UI.Controls;
using UFSoft.UBF.Report.UI.ReportView.Web;
using UFSoft.UBF.UI.WebControlAdapter;
using UFSoft.UBF.UI.FormProcess;
using UFSoft.UBF.UI.IView;
using UFSoft.UBF.UI.Engine;
using UFSoft.UBF.UI.Engine.Builder;
using UFSoft.UBF.UI.Engine.Authorization;
using UFSoft.UBF.UI.MD.Runtime;
using UFSoft.UBF.UI.ActionProcess;
using UFSoft.UBF.UI.ControlModel;
using UFSoft.UBF.UI.Controls;
using UFSoft.UBF.UI.WebControls.Association;
using UFSoft.UBF.UI.WebControls.ClientCallBack;
using System.Web.UI;
using UFSoft.UBF.UI.UIFormPersonalization;
using System.Collections.Specialized;


/***********************************************************************************************
 * Form ID:2432ff77-a33d-4a9c-8960-7f58b16f8e06 
 * Form Name:DetailInfoForm
 * UIFactory Auto Generator
 ***********************************************************************************************/
namespace DetailInfo
{
	[FormRegister("UFIDA.U9.Learn.ItemUI","DetailInfo.DetailInfoFormWebPart", "UFIDA.U9.Learn.ItemUI.WebPart", "2432ff77-a33d-4a9c-8960-7f58b16f8e06","WebPart", "False", 630, 375)] 
	///insert into aspnet_Parts (SysVersion, Path, ClassName, [Assembly], FormId) values (0, 'UFIDA.U9.Learn.ItemUI', 'DetailInfo.DetailInfoFormWebPart', 'UFIDA.U9.Learn.ItemUI.WebPart', '2432ff77-a33d-4a9c-8960-7f58b16f8e06')
	///<siteMapNode url="~/erp/simple.aspx?lnk=2432ff77-a33d-4a9c-8960-7f58b16f8e06" title="DetailInfoForm"/>
    public partial class DetailInfoFormWebPart : UFSoft.UBF.UI.FormProcess.BaseWebForm
    {
		#region Page Controller/Code Behind
        private static readonly ILogger logger = LoggerManager.GetLogger(typeof(DetailInfoFormWebPart));
        private string assemblyName = System.Reflection.Assembly.GetExecutingAssembly().FullName;
        //private string displayNamePostfix = "displayName";

		#region 强类型化基类属性.
		public new DetailInfoAction Action
		{
			get { return (DetailInfoAction)base.Action; }
			set { base.Action = value; }
		}
		DetailInfoModel _uimodel=null;
		public new DetailInfoModel Model
		{
			get 
			{
			     if(_uimodel == null){
			          _uimodel = new DetailInfoModel();
			     }
			     return _uimodel; 
			}
			set { _uimodel = value; }
		}
        protected override IUIModel UIModel{
            get{
                return this.Model;
            }
            set{
                this.Model = value as DetailInfoModel;
            }
        }
		#endregion 
		public FormAdjust adjust;
        #region variable declaration
        IUFCard Card0;
        IUFDataGrid DataGrid0;
        IUFCard Card1;
        IUFButton BtnClose;
        IUFButton BtnOk;
        IUFButton BtnClear;
        IUFDropDownButton DDBtnActivity;
        IUFDropDownButton DDBtnQuery;
        IUFDropDownButton DDBtnOperation;
		UpdatePanel updatePanel;
		HiddenField wpFindID;
		IUFContainer topLevelPanel;     
        IUFSeparator SeparatorInFavorites;
        IUFButton BtnDefaultValues;
        #endregion
        
        #region constructor
        public DetailInfoFormWebPart()
        {
            FormID = "2432ff77-a33d-4a9c-8960-7f58b16f8e06";
            IsAutoSize = bool.Parse("False");
            NewIsAutoSize = bool.Parse("False");
        }
        #endregion


	
            
	//获取档案版型结果: 

        #region eventBind and databind
        private void EventBind()
        {
			//事件绑定模板
				//Button控件事件
			this.BtnClose.Click += new EventHandler(BtnClose_Click);		
						
				//Button控件事件
			this.BtnOk.Click += new EventHandler(BtnOk_Click);		
						

	
			//Grid控件的分页事件				
			((UFWebDataGridAdapter)this.DataGrid0).GridMakePageEventHandler += new GridMakePageDelegate(UFGridDataGrid0_GridMakePageEventHandler);
             //Grid控件的客户化筛选，定位事件
            ((UFWebDataGridAdapter)this.DataGrid0).GridCustomFilterHandler += new GridCustomFilterDelegate(UFGridDataGrid0_GridCustomFilterHandler);

            AfterEventBind();
        }
        #endregion            
        
		#region override method
		protected override void OnLoad(EventArgs e)
		{
			base.OnLoad2(e);
		}
		protected override void OnLoadDataDo(EventArgs e)
		{
		    adjust.ProcessAdjustBeforeOnLoad(this);
			if (UIEngineHelper.IsDataBind(PageStatus, this))
			{
				if(this.Model==null){				        
					this.Model = new DetailInfoModel();
				}
				OnLoadConsumer(new InParameterModel[]{},new InParameterModel[]{});
				OnLoadData(this);
				this.IsDataBinding = true ; //加载完数据要绑定一次.目前加这.
			}
			else
			{
				//去除.已经移入到OnInit()中.
				//this.Model = (DetailInfoModel)this.CurrentState[this.TaskId.ToString()];
			}
			adjust.ProcessAdjustAfterOnLoadData(this);
		            AfterOnLoad();
            
            adjust.ProcessAdjustAfterOnLoad(this);
		}
		protected override void OnPreRender(EventArgs e)
		{
			base.OnPreRender2(e);
		}
        protected override void OnPreRenderDo(EventArgs e)
        {
            adjust.ProcessAdjustBeforeOnPreRender(this);
			base.OnPreRender(e);
			this.CurrentState[this.TaskId.ToString()] = this.Model;
			RegisterClearWebPartPadding();
            UFIDA.U9.UI.PDHelper.FormAuthorityHelper.SetWebPartAuthorization(this);
            
			if (IsDataBinding) //2006-9-7 可由开发人员控制
			{
				BeforeUIModelBinding();
								if(!Page.IsPostBack)
				{
					EnumTypeBinding.BindEnumControls(this);
				}
				UFIDA.U9.UI.Commands.CommandHelper.BindFlexData(this);
				adjust.ProcessAdjustBeforeDataBinding(this);
				if (this.IsOnlyDataBinding)
				{
					this.DataBinding();
				}
				adjust.ProcessAdjustAfterDataBinding(this);

				AfterUIModelBinding();
			}
			adjust.ProcessAdjustAfterOnPreRender(this);
        }
		protected override void OnInit(EventArgs e)
		{
			base.OnInit2(e);
		}
		protected override void OnInitDo(EventArgs e)
		{			 
			this.Page.InitComplete += new EventHandler(Page_InitComplete);
			WebPartBuilder.InitWebPart(this);
            this.Action = new DetailInfoAction(this);
            adjust = new FormAdjust();
		    CreateFormChildControls();
		}
        void Page_InitComplete(object sender, EventArgs e)
        {

            adjust.ProcessInit(this);
        }
        #endregion

      
        
        #endregion

	
		/// <summary>
        /// WebPart View
        /// </summary>
        #region view Create Contorls
        private void CreateFormChildControls()
        {
            IUFContainer _panel = UIControlBuilder.BuildTopLevelContainer(this,"DetailInfoForm",true,630,375);
            CommonBuilder.ContainerGridLayoutPropBuilder(_panel, 1, 2, 0, 10, 10, 10, 10, 10);
			InitViewBindingContainer(this, _panel,  null, "", "", null, 1, "");
			UIControlBuilder.BuildContainerGridLayout(_panel, 10,new GridColumnDef[]{new GridColumnDef(610,bool.Parse("True"),"Title"),},new GridRowDef[]{new GridRowDef(320,bool.Parse("True")),new GridRowDef(25,bool.Parse("True")),});
            //???还有用么?
            topLevelPanel = _panel;    
            
            UIControlBuilder.BuildCommonControls(this,ref updatePanel,ref wpFindID);
            





	
			_BuilderControl_Card0(_panel);

		
			UIControlBuilder.BuilderUFControl(this.Card0, "1");		


	
			_BuilderControl_Card1(_panel);

		
			UIControlBuilder.BuilderUFControl(this.Card1, "2");		



		
     
			
			
            EventBind();
            AfterCreateChildControls();
            
        }        







	                   
        private IUFCard _BuilderControl_Card0(IUFContainer container)
        {
            IUFCard _UFCard = UIControlBuilder.BuildCard(container,"Card0",false,"none", true, true, "1","","ae5bf231-7a5d-4c4e-b431-f88150a71271");
			CommonBuilder.GridLayoutPropBuilder(container, _UFCard, 610, 320, 0, 0, 1, 1, "100");
            CommonBuilder.ContainerGridLayoutPropBuilder(_UFCard, 11, 13, 0, 5, 0, 0, 0, 0);
			InitViewBindingContainer(this, _UFCard,  null, "", "", null, 1, "");
			UIControlBuilder.BuildContainerGridLayout(_UFCard, 5,new GridColumnDef[]{new GridColumnDef(90,bool.Parse("True"),"Title"),new GridColumnDef(5,bool.Parse("True"),"Spacing"),new GridColumnDef(90,bool.Parse("True"),"Value"),new GridColumnDef(20,bool.Parse("True"),"Spacing"),new GridColumnDef(90,bool.Parse("True"),"Title"),new GridColumnDef(5,bool.Parse("True"),"Spacing"),new GridColumnDef(90,bool.Parse("True"),"Value"),new GridColumnDef(20,bool.Parse("True"),"Spacing"),new GridColumnDef(90,bool.Parse("True"),"Title"),new GridColumnDef(5,bool.Parse("True"),"Spacing"),new GridColumnDef(89,bool.Parse("True"),"Value"),},new GridRowDef[]{new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),new GridRowDef(20,bool.Parse("True")),});
            this.Card0 = _UFCard;

            ///foreach UFCard下的所有控件，增加到此容器





	
			_BuilderControl_DataGrid0(_UFCard);

		
			UIControlBuilder.BuilderUFControl(this.DataGrid0, "0");		



	

            
            container.Controls.Add(_UFCard);
            return _UFCard;
        }

				





       
        private void _BuilderControl_DataGrid0(IUFContainer container)
        {
            IUFDataGrid _UFGrid = UIControlBuilder.BuildGridControl("DataGrid0", UFSoft.UBF.UI.ControlModel.EditStatus.Edit, true, true,true,true,true,true,20,false, false) ;
  			UIControlBuilder.BuilderUFControl(_UFGrid, "True", "True", "0");
			CommonBuilder.GridLayoutPropBuilder(container, _UFGrid, 500, 270, 0, 1, 9, 11, "100");
			InitViewBindingContainer(this, _UFGrid,  this.Model.DetailLine, "DetailLine", "", null, 20, "");
			((UFSoft.UBF.UI.WebControlAdapter.UFWebDataGridAdapter)_UFGrid).PagingStrategy=UFSoft.UBF.UI.ControlModel.GridPagingStrategy.Auto;
			_UFGrid.AllowSelectAllPage=false;
			((UFSoft.UBF.UI.WebControls.UFGrid)_UFGrid).IsSumAllData=false;
		        ((UFSoft.UBF.UI.WebControls.UFGrid)_UFGrid).IsSumSelectedData=false;
            this.DataGrid0 = _UFGrid;
            container.Controls.Add(_UFGrid);



			IUFDataGridColumn column ;
			GridColumn gridColumn ;
	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"ID","TextBoxColumnModel", "", 0,this.Model.DetailLine.Fields["ID"]/*ID*/,"ID", true, false, true, false, false, false, 7, 100, "",true, false,"","91efeaeb-3b2e-4e85-92bf-15218b07b83c","91efeaeb-3b2e-4e85-92bf-15218b07b83c","c43f4933-f25c-412f-a284-1a916b7acc29");
         
			GridControlBuilder.GridTextBoxColumnBuilder((IUFTextBoxColumn)column,"",TextAlign.Right, false,"",false,"1","1","") ;          
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"Code","TextBoxColumnModel", "", 0,this.Model.DetailLine.Fields["Code"]/*Code*/,"Code", false, true, true, false, false, false, 0, 100, "50",true, false,"","2306c1e7-83c2-42e9-b8d0-0cfb7d9a6b1e","2306c1e7-83c2-42e9-b8d0-0cfb7d9a6b1e","e4275896-371c-4f5b-96af-b19832a7718c");
         
			GridControlBuilder.GridTextBoxColumnBuilder((IUFTextBoxColumn)column,"",TextAlign.Left, false,"",false,"1","1","50") ;          
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"Name","TextBoxColumnModel", "", 0,this.Model.DetailLine.Fields["Name"]/*Name*/,"Name", false, true, true, false, false, false, 0, 100, "50",true, false,"","d79e7097-1a64-4f3c-b2cd-2568d071de49","d79e7097-1a64-4f3c-b2cd-2568d071de49","73186738-b02a-4425-8b9c-a2d75c4b0116");
         
			GridControlBuilder.GridTextBoxColumnBuilder((IUFTextBoxColumn)column,"",TextAlign.Left, false,"",false,"1","1","50") ;          
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"Qty","TextBoxColumnModel", "", 0,this.Model.DetailLine.Fields["Qty"]/*Qty*/,"Qty", false, true, true, false, false, false, 0, 100, "50",true, false,"","c327e68d-9472-4119-9f5f-eb897a91313b","c327e68d-9472-4119-9f5f-eb897a91313b","01307698-ea2f-49ec-9357-b9ba269b3076");
         
			GridControlBuilder.GridTextBoxColumnBuilder((IUFTextBoxColumn)column,"",TextAlign.Left, false,"",false,"1","1","50") ;          
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"Memo","TextBoxColumnModel", "", 0,this.Model.DetailLine.Fields["Memo"]/*Memo*/,"Memo", false, true, true, false, false, false, 0, 100, "50",true, false,"","07589851-b8aa-4734-94f2-3d6143a040bf","07589851-b8aa-4734-94f2-3d6143a040bf","89a4b420-1f3d-4c01-92d0-53c2ce356f08");
         
			GridControlBuilder.GridTextBoxColumnBuilder((IUFTextBoxColumn)column,"",TextAlign.Left, false,"",false,"1","1","50") ;          
	  
		 
        }

	                   
        private IUFCard _BuilderControl_Card1(IUFContainer container)
        {
            IUFCard _UFCard = UIControlBuilder.BuildCard(container,"Card1",false,"FunctionBar", true, true, "2","","4760b2ad-4198-42c0-8c50-19ec8c78c95d");
			CommonBuilder.GridLayoutPropBuilder(container, _UFCard, 610, 25, 0, 1, 1, 1, "100");
            CommonBuilder.ContainerGridLayoutPropBuilder(_UFCard, 11, 1, 0, 0, 0, 0, 10, 0);
			InitViewBindingContainer(this, _UFCard,  null, "", "", null, 1, "");
			UIControlBuilder.BuildContainerGridLayout(_UFCard, 0,new GridColumnDef[]{new GridColumnDef(80,bool.Parse("True"),"Spacing"),new GridColumnDef(10,bool.Parse("True"),"Spacing"),new GridColumnDef(80,bool.Parse("True"),"Spacing"),new GridColumnDef(10,bool.Parse("True"),"Spacing"),new GridColumnDef(80,bool.Parse("True"),"Spacing"),new GridColumnDef(60,bool.Parse("True"),"Value"),new GridColumnDef(80,bool.Parse("True"),"Spacing"),new GridColumnDef(30,bool.Parse("True"),"Spacing"),new GridColumnDef(80,bool.Parse("True"),"Spacing"),new GridColumnDef(10,bool.Parse("True"),"Spacing"),new GridColumnDef(80,bool.Parse("True"),"Spacing"),},new GridRowDef[]{new GridRowDef(20,bool.Parse("True")),});
            this.Card1 = _UFCard;

            ///foreach UFCard下的所有控件，增加到此容器





				this.BtnClose = UIControlBuilder.BuilderUFButton(_UFCard, true, "BtnClose", true, true, 80, 20, 6, 0, 1, 1, "100","", this.Model.ElementID,"",false,"020a5365-8f12-4970-b8df-17ce3ae60a68","020a5365-8f12-4970-b8df-17ce3ae60a68","b9b203c0-dda0-4c63-b43c-0461e5dc9d86");
	

		
			UIControlBuilder.BuilderUFControl(this.BtnClose, "6");		


				this.BtnOk = UIControlBuilder.BuilderUFButton(_UFCard, true, "BtnOk", true, true, 80, 20, 4, 0, 1, 1, "100","", this.Model.ElementID,"",false,"626ebf9b-f65a-4dd5-8f32-96f84919878c","626ebf9b-f65a-4dd5-8f32-96f84919878c","b64177f6-d2ff-4752-a35b-70bfdcc1e86d");
	

		
			UIControlBuilder.BuilderUFControl(this.BtnOk, "5");		


				this.BtnClear = UIControlBuilder.BuilderUFButton(_UFCard, true, "BtnClear", true, false, 80, 20, 0, 0, 1, 1, "100","", this.Model.ElementID,"",false,"6ac671d4-6527-45e6-accc-cc1342244f0a","6ac671d4-6527-45e6-accc-cc1342244f0a","5dab01c4-6c15-44a4-bdb4-349ea2c7723d");
	

		
			UIControlBuilder.BuilderUFControl(this.BtnClear, "4");		


	
			_BuilderControl_DDBtnActivity(_UFCard);

		
			UIControlBuilder.BuilderUFControl(this.DDBtnActivity, "2");		


	
			_BuilderControl_DDBtnQuery(_UFCard);

		
			UIControlBuilder.BuilderUFControl(this.DDBtnQuery, "3");		


	
			_BuilderControl_DDBtnOperation(_UFCard);

		
			UIControlBuilder.BuilderUFControl(this.DDBtnOperation, "1");		



						

            
            container.Controls.Add(_UFCard);
            return _UFCard;
        }

				       
        private void _BuilderControl_DDBtnActivity(IUFContainer container)
        {
            IUFDropDownButton _dropDownButton = UIControlBuilder.BuildDropDownButton(container,"DDBtnActivity",false, true,"2"
            , 80, 20, 0, 0, 1, 1, "100","d24eab78-82b5-4f55-aa4a-f1c85a2c0489","4545bc1a-7e54-40d8-b34a-94e665147dec");
            this.DDBtnActivity = _dropDownButton;
            
            ///foreach DropDownButton下的所有控件，增加到此容器
        }

				       
        private void _BuilderControl_DDBtnQuery(IUFContainer container)
        {
            IUFDropDownButton _dropDownButton = UIControlBuilder.BuildDropDownButton(container,"DDBtnQuery",false, true,"3"
            , 80, 20, 0, 0, 1, 1, "100","61a151e6-462e-4392-b264-c988ddd844b8","0e86620a-8781-4cd4-87da-9dbf173c8ca7");
            this.DDBtnQuery = _dropDownButton;
            
            ///foreach DropDownButton下的所有控件，增加到此容器
        }

				       
        private void _BuilderControl_DDBtnOperation(IUFContainer container)
        {
            IUFDropDownButton _dropDownButton = UIControlBuilder.BuildDropDownButton(container,"DDBtnOperation",false, true,"1"
            , 80, 20, 0, 0, 1, 1, "100","c4e31736-3819-479a-9f0a-2a306ba44bec","71139d16-9189-4f96-835f-c17dd5be2a6b");
            this.DDBtnOperation = _dropDownButton;
            
            ///foreach DropDownButton下的所有控件，增加到此容器
        }





		#endregion
		

	}
}
